package com.example.consumerthird;

import lombok.extern.slf4j.Slf4j;
import org.hcl.common.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;

@SpringBootApplication
@EnableEurekaClient
@EnableBinding(ReceiveService.class)
@Slf4j
public class ConsumerThirdApplication {
    @Value("${spring.application.name}")
    String applicationName;

    public static void main(String[] args) {
        SpringApplication.run(ConsumerThirdApplication.class, args);
    }

    @StreamListener("myUserChannel")
    public void receive(User user){
        log.info("I'm "+applicationName);
        log.info("myUserChannel.groupB接收到消息："+user);
    }

}
